package com.zy.edu.controller;


import com.zy.edu.bean.Classinfo;
import com.zy.edu.bean.Jurisdiction;
import com.zy.edu.bean.InputParam;
import com.zy.edu.service.JurisdictionService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author HuangHaiShui
 * @since 2021-07-13
 */
@RestController
@RequestMapping("/juris")
public class JurisdictionController {

    @Resource
    JurisdictionService jurisdictionService;

    /**
     * @Author: HuangHaiShui
     * @Description: 数据的新增与修改
     * @Date: 9:17 2021/7/14
     * @param jurisdiction:
     * @return: Map
     **/
    @RequestMapping("/edit")
    public Map edit(@Valid Jurisdiction jurisdiction){
        return jurisdictionService.saveOrUpdate(jurisdiction);
    }

    /**
     * @Author: HuangHaiShui
     * @Description:数据数据的查询，可分页可查全部
     * @Date: 9:17 2021/7/14
     * @param jurisdiction:    name 模糊查询
     * @param inputParam:  分页条件
     * @return: Map
     **/
    @RequestMapping("/list")
    public Map list( Jurisdiction jurisdiction, InputParam inputParam){

        return jurisdictionService.list(jurisdiction, inputParam);
    }

    @RequestMapping("/getById")
    public Map getById(Jurisdiction classinfo, InputParam inputParam){

        return jurisdictionService.getById(classinfo, inputParam);
    }
    /**
     * @Author: HuangHaiShui
     * @Description: 删除数据
     * @Date: 9:18 2021/7/14
     * @param jurisdiction:  传入id 字段
     * @return: Map
     **/
    @RequestMapping("/dele")
    public Map dele( Jurisdiction jurisdiction){
        return jurisdictionService.dele(jurisdiction);
    }


    /**
     * @Author: HuangHaiShui 
     * @Description: 三级联动使用，根据角色查辖区
     * @Date: 9:30 2021/7/20
     * @param roleType: 
     * @param userId:
     * @return: Map
     **/
    @RequestMapping("getByRole")
    public Map getJurisByRole( Integer roleType,String userId  ) {

        return jurisdictionService.getJurisByRole(roleType,userId);
    }
}

